package com.yyy.dm.consumer.controller;

import com.yyy.dm.CommonResponse;
import com.yyy.dm.consumer.service.ItemConsumerService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

@RestController
@RequestMapping("/item")
public class ItemConsumerController {

    @Resource
    private ItemConsumerService itemConsumerService;
    //轮播图
    @PostMapping("/index/carousel")
    public CommonResponse carousel(){
        return itemConsumerService.carousel();
    }
    //商品详情
    @PostMapping("/desc/getItems")
    public CommonResponse getItems(@RequestBody Map<String,Long> param){
        return itemConsumerService.getItems(param.get("id"));
    }
    //今日推荐
    @PostMapping("/index/recommend")
    public CommonResponse recommend(){
        return itemConsumerService.recommend();
    }
    //首页即将开售
    @PostMapping("/index/sell")
    public CommonResponse sell(){
        return itemConsumerService.sell();
    }

    //首页分类排行
    @PostMapping("/index/seniority")
    public CommonResponse seniority(@RequestBody Map<String,Long> param){
        return itemConsumerService.seniority(param.get("itemTypeId"));
    }

    //多条件查询商品信息
    @PostMapping("/list/querygoodsinfos")
    public CommonResponse queryGoodsInfos(@RequestBody Map<String,String> param){
        return itemConsumerService.queryGoodsInfos(param);
    }

    //查询页猜你喜欢
    @PostMapping("/list/guesslike")
    public CommonResponse guessLike(@RequestBody Map<String,Long> param){
        return itemConsumerService.guessLike(param.get("itemTypeId"));
    }
}
